package basis.threadpool;

import java.util.Random;

public class Test {
    public static void main(String[] args) {
        ThreadPool threadPool = new ThreadPool(5);
        SourceTest test = new SourceTest();
        for (int i = 0; i < 24; ++i) {
            threadPool.execute(test::doSomething);
        }
    }
}

class SourceTest {
    public void doSomething() {
        Random ran = new Random();
        int thres = ran.nextInt(10000000);
        System.out.println(Thread.currentThread().getName() + "-执行任务，循环" + thres);
        while (thres-- > 0)
            ;
    }
}